package com.euond.permission.mapper;

import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import com.euond.common.core.dao.BaseEuondMapper;
import com.euond.permission.entities.UserPermission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Created by Daniel on 18/06/2017.
 * UserPermission Dao
 */
@Mapper
public interface UserPermissionMapper extends BaseEuondMapper<UserPermission> {
    /**
     * 查询用户权限（分页）
     * @param
     * @return
     */
    List<UserPermission> findUserPermissions(Pagination page, UserPermission userPermission);
    //List<UserPermission> findUserPermissions(Pagination page, UserPermission userPermission,@Param("userId") List<Long> userIds);

    /**
     * 按用户询出全量的用户权限数据(shiro)
     * @param
     * @return
     */
    List<UserPermission> findStringPermissions(@Param("userId") Long userId);


    /**
     * 按用户询出全量的用户权限数据
     * @param
     * @return
     */
    List<UserPermission> findNewPermissionsByUser(@Param("userId") Long userId);

    /**
     * 按资源通过用户角色、角色资源查询出全量的用户权限数据
     * @param
     * @return
     */
    List<UserPermission> findNewPermissionsByResource(@Param("resourceId") Long resourceId,@Param("companyId") Long companyId);

    /**
     * 按用户+资源查询拥有多个角色的权限明细
     * @param
     * @return
     */
    List<UserPermission> findMultiNewPermissions(@Param("userId") Long userId,@Param("resourceId") Long resourceId,@Param("companyId") Long companyId);
}
